package com.base.components.common.boot;

/**
 * ServerPort
 *
 * @author <a href="drakelee1221@gmail.com">LiGeng</a>
 * @version v1.0.0
 * @date 2019-03-26 15:37
 */
public class ServerPort {
  private static final int DEFAULT_RANDOM_SERVER_PORT_MIN = 60000;
  int port;
  boolean random;

  private ServerPort(int port, boolean random) {
    this.port = port;
    this.random = random;
  }

  public static ServerPort set(int port){
    return new ServerPort(port, false);
  }

  public static ServerPort random(){
    return new ServerPort(DEFAULT_RANDOM_SERVER_PORT_MIN, true);
  }

  public static ServerPort random(int minPort){
    return new ServerPort(minPort, true);
  }
}
